package com.ios.model.enums;

import lombok.Getter;

/**
 * 时间段枚举
 */
@Getter
public enum TimeSlot {
    MORNING(1, "上午", "08:00-12:00"),
    NOON(2, "中午", "12:00-14:00"),
    EVENING(3, "晚上", "18:00-22:00");

    private final int code;
    private final String name;
    private final String timeRange;

    TimeSlot(int code, String name, String timeRange) {
        this.code = code;
        this.name = name;
        this.timeRange = timeRange;
    }

    public static TimeSlot fromCode(int code) {
        for (TimeSlot slot : values()) {
            if (slot.code == code) {
                return slot;
            }
        }
        throw new IllegalArgumentException("Invalid time slot code: " + code);
    }
}